$ var foo = {
    name: "Frank",
    toString: function() {
        return this.name;
    }
};
<div data-foo=`${foo}`/>
<div data-foo=foo/>